import {
    createRouter,
    // createWebHistory,
    createWebHashHistory,

} from 'vue-router';
// import Home from '../views/Home.vue';
const routes = [
  {
    path: '/',
    name: 'Home',
    // component: Home,
    // alias: '/aaa',                     // 别名
    alias: ['/index', '/home'], // 别名-批量
    component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue'),
  },
  {
    path: '/about',
    name: 'About',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
  {
    path: '/aaa',
    name: 'aaa',
    component: () => import(/* webpackChunkName: "aaa" */ '../views/aaa.vue'),
  },
  {
    path: '/setup',
    name: 'setup',
    component: () =>
      import(/* webpackChunkName: "setup" */ '../views/setup/setup.vue'),
  },
  {
    path: '/setup/index',
    name: 'setup/index',
    component: () =>
      import(/* webpackChunkName: "setup" */ '../views/setup/index.vue'),
  },
  {
    path: '/computed',
    name: 'computed',
    component: () =>
      import(/* webpackChunkName: "computed" */ '../views/computed.vue'),
  },
  {
    path: '/hook',
    name: 'hook',
    component: () =>
      import(/* webpackChunkName: "hook" */ '../views/hook/hook.vue'),
  },
  {
    path: '/toRefs',
    name: 'toRefs',
    component: () =>
      import(/* webpackChunkName: "torefs" */ '../views/toRefs/toRefs.vue'),
  },
  {
    path: '/shallow',
    name: 'shallow',
    component: () =>
      import(/* webpackChunkName: "shallow" */ '../views/shallow.vue'),
  },
  {
    path: '/provide_inject',
    name: 'provide_inject',
    component: () =>
      import(
        /* webpackChunkName: "provide_inject" */ '../views/provide_inject/index.vue'
      ),
  },
  {
    path: '/label',
    name: 'label',
    component: () =>
      import(/* webpackChunkName: "label" */ '../views/label/index.vue'),
  },
  {
    path: '/ts',
    name: 'ts',
    // webpackChunkName。将同名的页面打包成一个 js 文件
    // webpackPrefetch，预下载
    component: () =>
      import(/* webpackChunkName: "ts" */ '../views/ts/index.vue'),
    children: [
      {
        path: 'types',
        component: () =>
          import(
            /* webpackChunkName: "ts" webpackPrefetch: true */ '../views/ts/types.vue'
          ),
      },
      {
        path: 'assertion',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/assertion.vue'),
      },
      {
        path: 'interface',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/interface.vue'),
      },
      {
        path: 'class',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/class.vue'),
      },
      {
        path: 'get_set',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/get_set.vue'),
      },
      {
        path: 'static',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/static.vue'),
      },
      {
        path: 'vue3',
        component: () =>
          import(/* webpackChunkName: "ts" */ '../views/ts/vue3.vue'),
      },
    ],
  },
]

const router = createRouter({
    // history: createWebHistory(),
    history: createWebHashHistory(),
    routes
});
router.beforeEach((to, from, next) => {
    // console.log(router)
    // console.log(to)
    // console.log(from)
    // console.log(store.state);		
    next();
});
export default router;